home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Pascal Super Library
/
Pascal Super Library (CW International)(1997).bin
/
LIBRARY
/
TP_TOOLS
/
MOUSE.DOC
< prev
next >
Wrap
Text File
|
1994-05-10
|
18KB
|
521 lines
PROGRAMMING MANUAL
------------------
The following list of routines were written to provide mouse support for
programs written in TURBO PASCAL (version 5.0). The routines provide support
for any mouse that adheres to the MicroSoft 2 button standard or to the
Logitech 3 button standard. Mouse routines supported include:
MOUSE_RESET
MOUSE_SHOW_CURSOR
MOUSE_HIDE_CURSOR
MOUSE_GET_POSITION
MOUSE_SET_POSITION
MOUSE_GET_BUTTON_PRESS
MOUSE_GET_BUTTON_RELEASE
MOUSE_SET_HOR_RANGE
MOUSE_SET_VER_RANGE
MOUSE_SET_DEFAULT_CURSOR
MOUSE_SET_CHECK_CURSOR
MOUSE_SET_HAND_CURSOR
MOUSE_SET_CROSS_CURSOR
MOUSE_SET_CLOCK_CURSOR
MOUSE_SET_TEXT_CURSOR
MOUSE_SET_GRAPHIC_CURSOR
MOUSE_GET_MOTION
MOUSE_LIGHT_PEN_ON
MOUSE_LIGHT_PEN_OFF
MOUSE_SET_USER_TASK
MOUSE_SET_MICKEY_RATIO
The following is a programming example for proper use of the mouse routines:
PROGRAM MOUSE_EXAMPLE
{$F+}
USES CRT, DOS, GRAPH, MOUSE
BEGIN
MOUSE_RESET(TheMouse);
IF NOT (TheMouse.Exists) THEN WRITELN('Sorry the mouse does not exist.');
END;
NOTES: 1) The compiler should be set to force FAR calls to insure proper
operation of the mouse.
2) The mouse unit MUST be included on the USES line (along with any
other required units).
PROGRAMMING MANUAL
------------------
MOUSE_RESET
USE MOUSE_RESET(TheMouse);
FUNCTION Initializes the mouse.
ARGUMENTS TheMouse :RECORD (Predefined in the MOUSE unit)
TheMouse.Exists :BOOLEAN
Returns true if mouse exists.
Returns false if mouse does not exist.
TheMouse.NoButtons :INTEGER
Returns the number of buttons on the mouse.
COMMENTS MOUSE_RESET should be called before any other mouse function
to insure proper operation of the mouse. Once the mouse has
been initialized the mouse cursor is positioned in the center
of the screen. However, a call to MOUSE_SHOW_CURSOR must be
made before the mouse cursor is visible.
PROGRAMMING MANUAL
------------------
MOUSE_SHOW_CURSOR
USE MOUSE_SHOW_CURSOR;
FUNCTION Displays the mouse cursor on the screen.
ARGUMENTS None
COMMENTS None
PROGRAMMING MANUAL
------------------
MOUSE_HIDE_CURSOR
USE MOUSE_HIDE_CURSOR;
FUNCTION Removes the mouse cursor from the screen.
ARGUMENTS None
COMMENTS Even though the mouse is not visible it is still
functional.
PROGRAMMING MANUAL
------------------
MOUSE_GET_POSITION
USE MOUSE_GET_POSITION(StaMouse);
FUNCTION Returns the current mouse cursor position.
ARGUMENTS StaMouse :RECORD (Predefined in the MOUSE unit)
StaMouse.ButtonStatus :INTEGER
Returns current mouse button status.
bit 0 = left button
bit 1 = right button
bit 2 = middle button (if any)
A 1 in any of the bits indicates that that mouse
button is pressed.
A 0 in any of the bits indicates that that mouse
button is not pressed.
StaMouse.Column :INTEGER
Returns the current horizontal position of the mouse
cursor.
StaMouse.Row :INTEGER
Returns the current vertical position of the mouse
cursor.
COMMENTS Data is reported in real-time. All mouse cursor position data
is returned in pixels whether the computer is in graphics mode
or text mode. To convert the returned position data into an
equivalent character position the user can use the following
conversion:
Horizontal position = TRUNC(StaMouse.Column / 8)
Vertical position = TRUNC(StaMouse.Row / N)
Where N = 8 (for CGA)
N = 14 (for EGA)
PROGRAMMING MANUAL
------------------
MOUSE_SET_POSITION
USE MOUSE_SET_POSITION(Column,Row);
FUNCTION Moves the mouse cursor to a specific position.
ARGUMENTS Column :INTEGER
Specifies a horizontal mouse cursor position.
Legal values: 1 to max screen size.
Row :INTEGER
Specifies a vertical mouse cursor position.
Legal values: 1 to max screen size.
COMMENTS All mouse cursor position data is specified in pixels whether
the computer is in graphics mode or text mode. To convert the
specified pixel position to an equivalent character position
the user can use the following conversion:
Horizontal position = TRUNC(character position * 8)
Vertical position = TRUNC(character position * N)
Where N = 8 (for CGA)
N = 14 (for EGA)
PROGRAMMING MANUAL
------------------
MOUSE_GET_BUTTON_PRESS
USE MOUSE_GET_BUTTON_PRESS(Button,StaMouse);
FUNCTION Returns mouse button press history.
ARGUMENTS Button :INTEGER
Specifies a mouse button of inquiry.
Legal values: 0,1,2
0 = left button
1 = right button
2 = middle button (if any)
StaMouse :RECORD (Predefined in the MOUSE unit)
StaMouse.ButtonStatus :INTEGER
Returns the current mouse button status.
bit 0 = left button
bit 1 = right button
bit 2 = middle button (if any)
A 1 in any of the bits indicates that that mouse button
is pressed.
A 0 in any of the bits indicates that that mouse button
is not pressed.
StaMouse.OpCount :INTEGER
Returns the number of mouse button presses since this
function was last called.
StaMouse.Column :INTEGER
Returns the horizontal position of the mouse cursor when
the button was last pressed.
StaMouse.Row :INTEGER
Returns the vertical position of the mouse cursor when
the button was last pressed.
COMMENTS A call to MOUSE_GET_BUTTON_PRESS clears the mouse buffer of
all mouse history.
PROGRAMMING MANUAL
------------------
MOUSE_GET_BUTTON_RELEASE
USE MOUSE_GET_BUTTON_RELEASE(Button,StaMouse);
FUNCTION Returns mouse button release history.
ARGUMENTS Button :INTEGER
Specifies a mouse button of inquiry.
Legal values: 0,1,2
0 = left button
1 = right button
2 = middle button (if any)
StaMouse :RECORD (Predefined in the MOUSE unit)
StaMouse.ButtonStatus :INTEGER
Returns the current mouse button status.
bit 0 = left button
bit 1 = right button
bit 2 = middle button (if any)
A 1 in any of the bits indicates that that mouse button
is pressed.
A 0 in any of the bits indicates that that mouse button
is not pressed.
StaMouse.OpCount :INTEGER
Returns the number of mouse button releases since this
function was last called.
StaMouse.Column :INTEGER
Returns the horizontal position of the mouse cursor when
the button was last released.
StaMouse.Row :INTEGER
Returns the vertical position of the mouse cursor when
the button was last released.
COMMENTS A call to MOUSE_GET_BUTTON_RELEASE clears the mouse buffer of
all mouse history.
PROGRAMMING MANUAL
------------------
MOUSE_SET_HOR_RANGE
USE MOUSE_SET_HOR_RANGE(Minimum,Maximum);
FUNCTION Sets the horizontal limits of mouse cursor movement.
ARGUMENTS Minimum :INTEGER
Specifies the minimum horizontal position allowed.
Legal values: 1 to maximum screen size.
Maximum :INTEGER
Specifies the maximum horizontal position allowed.
Legal values: 1 to maximum screen size.
COMMENTS It is recommended that the maximum value be larger than the
minimum value.
PROGRAMMING MANUAL
------------------
MOUSE_SET_VER_RANGE
USE MOUSE_SET_VER_RANGE(Minimum,Maximum);
FUNCTION Sets the vertical limits of mouse cursor movement.
ARGUMENTS Minimum :INTEGER
Specifies the minimum vertical position allowed.
Legal values: 1 to maximum screen size.
Maximum :INTEGER
Specifies the maximum vertical position allowed.
Legal values: 1 to maximum screen size.
COMMENTS It is recommended that the maximum value be larger than the
minimum value.
PROGRAMMING MANUAL
------------------
MOUSE_SET_DEFAULT_CURSOR
USE MOUSE_SET_DEFAULT_CURSOR;
FUNCTION Sets the mouse cursor to the default (arrow) type.
ARGUMENTS None
COMMENTS None
PROGRAMMING MANUAL
------------------
MOUSE_SET_CHECK_CURSOR
USE MOUSE_SET_CHECK_CURSOR;
FUNCTION Sets the mouse cursor to the check mark type.
ARGUMENTS None
COMMENTS None
PROGRAMMING MANUAL
------------------
MOUSE_SET_HAND_CURSOR
USE MOUSE_SET_HAND_CURSOR;
FUNCTION Sets the mouse cursor to the hand type.
ARGUMENTS None
COMMENTS None
PROGRAMMING MANUAL
------------------
MOUSE_SET_CROSS_CURSOR
USE MOUSE_SET_CROSS_CURSOR;
FUNCTION Sets the mouse cursor to the cross (plus) type.
ARGUMENTS None
COMMENTS None
PROGRAMMING MANUAL
------------------
MOUSE_SET_CLOCK_CURSOR
USE MOUSE_SET_CLOCK_CURSOR;
FUNCTION Sets the mouse cursor to the clock (hour glass) type.
ARGUMENTS None
COMMENTS None
PROGRAMMING MANUAL
------------------
MOUSE_SET_TEXT_CURSOR
USE MOUSE_SET_TEXT_CURSOR(CursorType,ScreenMask,CursorMask);
FUNCTION Sets the mouse text cursor type and parameters.
ARGUMENTS CursorType :WORD
Specifies the text cursor type.
Legal values: 0 or 1
0 = Software cursor (default)
1 = Hardware cursor
ScreenMask :WORD
Specifies the screen mask parameter.
CursorMask :WORD
Specifies the cursor mask parameter.
COMMENTS Two cursors are available. One is the hardware cursor (also
known as the text cursor). The other is the software cursor
(the normal mouse cursor). This function allows the user to
reassign the hardware cursor such that it is under control
of the mouse (the keyboard cursor and the mouse cursor are
one and the same). For more information refer to a mouse
handbook.
PROGRAMMING MANUAL
------------------
MOUSE_SET_GRAPHIC_CURSOR
USE MOUSE_SET_GRAPHIC_CURSOR(XHot,YHot,MaskSeg,MaskOff);
FUNCTION Sets the mouse graphic cursor type and parameters.
ARGUMENTS XHot :INTEGER
Specifies the graphic cursor horizontal hot spot.
Legal values: -16 to 16
YHot :INTEGER
Specifies the graphic cursor vertical hot spot.
Legal values: -16 to 16
MaskSeg :WORD
Specifies the segment address of the array containing
the new cursor.
MaskOff :WORD
Specifies the offset address of the array containing
the new cursor.
COMMENTS For more information refer to a mouse handbook.
PROGRAMMING MANUAL
------------------
MOUSE_GET_MOTION
USE MOUSE_GET_MOTION(NewMouse);
FUNCTION Returns mouse movement history.
ARGUMENTS NewMouse :RECORD (Predefined in the MOUSE unit)
NewMouse.HPlace :INTEGER
Returns the horizontal mickey count change since this
function was last called.
NewMouse.VPlace :INTEGER
Returns the vertical mickey count change since this
function was last called.
COMMENTS The mickey count change is defined as the position difference
(in mickeys) from the current mouse cursor position to the
mouse cursor position at the last call to MOUSE_GET_POSITION.
The horizontal and vertical mickey counts are reset to zero
whenever this function is called.
PROGRAMMING MANUAL
------------------
MOUSE_LIGHT_PEN_ON
USE MOUSE_LIGHT_PEN_ON;
FUNCTION Sets the light pen emulation to on.
ARGUMENTS None
COMMENTS This function is seldom required as the MOUSE_RESET function
sets the light pen emulation on by default.
PROGRAMMING MANUAL
------------------
MOUSE_LIGHT_PEN_OFF
USE MOUSE_LIGHT_PEN_OFF;
FUNCTION Sets the light pen emulation to off.
ARGUMENTS None
COMMENTS This function is seldom required unless one is writting
software that will use the mouse and a SEPARATE light
pen.
PROGRAMMING MANUAL
------------------
MOUSE_SET_USER_TASK
USE MOUSE_SET_USER_TASK(Mask,TaskSeg,TaskOff);
FUNCTION Used to set up a user defined mouse software interrupt.
ARGUMENTS Mask :WORD
Specifies the mouse condition(s) that will create
the interrupt.
TaskSeg :WORD
Specifies the segment address of the software interrupt.
TaskOff :WORD
Specifies the offset address of the software interrupt.
COMMENTS This function allows the user to define one of their own
subroutines as a mouse interrupt. Whenever the condition
specified by the Mask occurs the program will automatically
route control to the subroutine pointed to by the segment
and offset addressed. For more information please refer to
a mouse handbook.
PROGRAMMING MANUAL
------------------
MOUSE_SET_MICKEY_RATIO
USE MOUSE_SET_MICKEY_RATIO(Horizontal,Vertical);
FUNCTION Used to adjust the mouse physical movement verses the
mouse cursor movement ratio.
ARGUMENTS Horizontal :INTEGER
Specifies the horizontal movement ratio.
Legal values: 1 to 32767
Vertical :INTEGER
Specifies the vertical movement ratio.
Legal values: 1 to 32767
COMMENTS The arguments specify the number of mickeys (unit of mouse
movement) per eight screen pixels. The horizontal default
is 8 mickeys to 8 pixels. With this ratio the mouse must
move 3.2 inches to move the mouse cursor completely across
the screen. The vertical default is 16 mickeys to 8 pixels.
With this ratio the mouse must move 2 inches to move the
mouse completely up or down the screen.